/* 
Copyright 2012 Brian Hawkins
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package genorm.runtime;

import java.sql.Statement;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.sql.SQLWarning;
import java.sql.Connection;



public class StatementWrapper implements Statement
	{
	protected Statement m_statement;
	
	public StatementWrapper(Statement statement)
		{
		m_statement = statement;
		}

	public ResultSet executeQuery(String sql) throws SQLException
		{
		return (m_statement.executeQuery(sql));
		}


	public int executeUpdate(String sql) throws SQLException
		{
		return (m_statement.executeUpdate(sql));
		}


	public void close() throws SQLException
		{
		m_statement.close();
		}

	//----------------------------------------------------------------------


	public int getMaxFieldSize() throws SQLException
		{
		return (m_statement.getMaxFieldSize());
		}


	public void setMaxFieldSize(int max) throws SQLException
		{
		m_statement.setMaxFieldSize(max);
		}


	public int getMaxRows() throws SQLException
		{
		return (m_statement.getMaxRows());
		}


	public void setMaxRows(int max) throws SQLException
		{
		m_statement.setMaxRows(max);
		}


	public void setEscapeProcessing(boolean enable) throws SQLException
		{
		m_statement.setEscapeProcessing(enable);
		}


	public int getQueryTimeout() throws SQLException
		{
		return (m_statement.getQueryTimeout());
		}


	public void setQueryTimeout(int seconds) throws SQLException
		{
		m_statement.setQueryTimeout(seconds);
		}


	public void cancel() throws SQLException
		{
		m_statement.cancel();
		}


	public SQLWarning getWarnings() throws SQLException
		{
		return (m_statement.getWarnings());
		}


	public void clearWarnings() throws SQLException
		{
		m_statement.clearWarnings();
		}


	public void setCursorName(String name) throws SQLException
		{
		m_statement.setCursorName(name);
		}

	//----------------------- Multiple Results --------------------------


	public boolean execute(String sql) throws SQLException
		{
		return (m_statement.execute(sql));
		}


	public ResultSet getResultSet() throws SQLException
		{
		return (m_statement.getResultSet());
		}


	public int getUpdateCount() throws SQLException
		{
		return (m_statement.getUpdateCount());
		}


	public boolean getMoreResults() throws SQLException
		{
		return (m_statement.getMoreResults());
		}


	//--------------------------JDBC 2.0-----------------------------


	public void setFetchDirection(int direction) throws SQLException
		{
		m_statement.setFetchDirection(direction);
		}


	public int getFetchDirection() throws SQLException
		{
		return (m_statement.getFetchDirection());
		}


	public void setFetchSize(int rows) throws SQLException
		{
		m_statement.setFetchSize(rows);
		}


	public int getFetchSize() throws SQLException
		{
		return (m_statement.getFetchSize());
		}


	public int getResultSetConcurrency() throws SQLException
		{
		return (m_statement.getResultSetConcurrency());
		}


	public int getResultSetType()  throws SQLException
		{
		return (m_statement.getResultSetType());
		}


	public void addBatch( String sql ) throws SQLException
		{
		m_statement.addBatch(sql);
		}


	public void clearBatch() throws SQLException
		{
		m_statement.clearBatch();
		}


	public int[] executeBatch() throws SQLException
		{
		return (m_statement.executeBatch());
		}


	public Connection getConnection()  throws SQLException
		{
		return (m_statement.getConnection());
		}

	//--------------------------JDBC 3.0-----------------------------


	public boolean getMoreResults(int current) throws SQLException
		{
		return (m_statement.getMoreResults(current));
		}


	public ResultSet getGeneratedKeys() throws SQLException
		{
		return (m_statement.getGeneratedKeys());
		}


	public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
		{
		return (m_statement.executeUpdate(sql, autoGeneratedKeys));
		}


	public int executeUpdate(String sql, int columnIndexes[]) throws SQLException
		{
		return (m_statement.executeUpdate(sql, columnIndexes));
		}


	public int executeUpdate(String sql, String columnNames[]) throws SQLException
		{
		return (m_statement.executeUpdate(sql, columnNames));
		}


	public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
		{
		return (m_statement.execute(sql, autoGeneratedKeys));
		}


	public boolean execute(String sql, int columnIndexes[]) throws SQLException
		{
		return (m_statement.execute(sql, columnIndexes));
		}


	public boolean execute(String sql, String columnNames[]) throws SQLException
		{
		return (m_statement.execute(sql, columnNames));
		}


	public int getResultSetHoldability() throws SQLException
		{
		return (m_statement.getResultSetHoldability());
		}


	//--------------------------JDBC 4.0-----------------------------
	public boolean isClosed() throws SQLException
		{
		return (m_statement.isClosed());
		}


	public void setPoolable(boolean poolable)
			throws SQLException
		{
		m_statement.setPoolable(poolable);
		}


	public boolean isPoolable()
			throws SQLException
		{
		return (m_statement.isPoolable());
		}
		
	public boolean isWrapperFor(Class<?> iface)
			throws SQLException
		{
		return (m_statement.isWrapperFor(iface));
		}
		
	public <T> T unwrap(Class<T> iface)
			throws SQLException
		{
		return (m_statement.unwrap(iface));
		}

	//--------------------------JDBC 4.1-----------------------------
	public void closeOnCompletion()
			throws SQLException
		{
		m_statement.closeOnCompletion();
		}
		
	public boolean isCloseOnCompletion()
			throws SQLException
		{
		return (m_statement.isCloseOnCompletion());
		}
	}
